package com.session01;

public class Account {
    private int accontNumber;     //账号
    private double balance;       //余额

    public double getBalance() {    //  存钱
        return balance;
    }

    public int getAccontNumber() {
        return accontNumber;
    }

    public void depsoit(double money) {
        this.balance += money;
    }

    public void withdraw(double money) throws BankException {
        if (this.balance >= money) {
            this.balance -= money;
        } else {
            double needs = money - this.balance;
            throw new BankException("余额不足", needs);
        }
    }
}
